package com.mumu.test.deepseek;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * @Author: MuMu
 * @Date: 2025/2/6 11:28
 */
public class Test {

    // 聊天记录
    public static List<RequestMessageItem> requestMessageItemList = new ArrayList<>();


    public static void main(String[] args) {
        input();
    }


    // 键盘输入聊天
    public static void input(){
        Scanner scanner = new Scanner(System.in);
        System.out.print("\n请输入您的问题：");
        String input = scanner.nextLine();
        if (input.isEmpty()){
            input();
            return;
        }

        System.out.print("思考中...");
        DeepSeekClient deepSeekClient = new DeepSeekClient();
        requestMessageItemList.add(new RequestMessageItem("user", input));


        deepSeekClient.ask(requestMessageItemList, false, new DeepSeekClient.Lis() {
            @Override
            public void error() {
                System.out.println("\n处理失败（服务器响应超时）");
                input();
            }

            @Override
            public void msg(String msg) {
                System.out.print("\n回答：");
                System.out.print(deepSeekClient.getMsg(msg));
            }

            @Override
            public void end() {
                System.out.print("\n");
                input();
            }
        });

    }
}
